/*
 * PadraoDAO.java
 *
 * Created on 17 de Junho de 2009, 20:25
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package sisnutri.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import sisnutri.OracleConnectionFactory;
import sisnutri.PadraoBean;

/**
 *
 * @author Bruno
 */
public class PadraoDAO {
    
    /** Creates a new instance of PadraoDAO */
    public PadraoDAO() {
    }
    
        public boolean insertPadrao(PadraoBean padrao){
        Connection con = null;
        PreparedStatement stm = null;
        try {
            String sql = null;
            con = OracleConnectionFactory.getConnection();
            
            sql = "INSERT_PADRAO(?, ?, ?, ?);";
            
            stm = con.prepareStatement(sql);
            
            stm.setString(1, padrao.getNome());
            stm.setInt(2, padrao.getIdFinal());
            stm.setInt(3, padrao.getIdFinal());
            stm.setString(4, padrao.getSexo());

           
            stm.execute();
            
            con.close();
            stm.close();
            return true;
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return false;        
    }
    
}
